package com.example.springpethospital.mapper;

import java.util.*;

import com.example.springpethospital.entity.Illcase;
import org.apache.ibatis.annotations.*;

@Mapper
public interface IllcaseMapper {
    @Insert("insert into t_illcase(name, reception, examination, diagnostic, treatment) values (#{name}, #{reception}, #{examination}, #{diagnostic}, #{treatment})")
    boolean AddCase(String name, String reception, String examination, String diagnostic, String treatment);

    @Update("update t_illcase set name=#{name}, reception=#{reception}, examination=#{examination}, diagnostic=#{diagnostic}, treatment=#{treatment} where id=#{id}")
    boolean ModifyCase(int id, String name, String reception, String examination, String diagnostic, String treatment);

    @Delete("delete from t_illcase where id=#{id}")
    boolean RemoveCase(int id);

    @Select("select * from t_illcase where name like '%${name}%'")
    List<Illcase> GetCases(String name);

    @Select("select * from t_illcase where name like '%${name}%' limit #{offset},#{limit}")
    List<Illcase> GetCasesWithPage(String name, int offset, int limit);

    @Select("select count(*) from t_illcase where name like '%${name}%'")
    Integer getCaseNum(String name);
}